local LGbenghuai = fk.CreateSkill {

  name = "LGbenghuai",

  tags = { Skill.Compulsory },

}

Fk:loadTranslationTable{
    ["LGbenghuai"] = "崩坏",
    [":LGbenghuai"] = "锁定技，结束阶段，若你不是体力值最低的角色，则你失去1点体力或减少1点体力上限，并摸一张牌。",
}

LGbenghuai:addEffect(fk.EventPhaseStart, {
  anim_type = "negative",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(LGbenghuai.name) and player.phase == Player.Finish and
      table.find(player.room.alive_players, function(p)
        return p.hp < player.hp
      end)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local choice = room:askToChoice(player, {
      choices = {"loseMaxHp", "loseHp"},
      skill_name = LGbenghuai.name,
    })
    if choice == "loseMaxHp" then
      room:changeMaxHp(player, -1)
    else
      room:loseHp(player, 1, LGbenghuai.name)
    end
  end,
})

return LGbenghuai